package com.chenyuxin.ilp.security.perm.jwt;

import com.chenyuxin.ilp.model.vo.user.UserLoginVo;
import lombok.Getter;
import lombok.Setter;
import org.springframework.security.authentication.AbstractAuthenticationToken;
@Getter
@Setter
public class UserJwtAuthentication extends AbstractAuthenticationToken {
    private String jwtToken;
    private UserLoginVo currentUser;

    public UserJwtAuthentication() {
        // 权限，用不上，直接null
        super(null);
    }
    @Override
    public Object getCredentials() {
        return isAuthenticated()?null:jwtToken;
    }

    @Override
    public Object getPrincipal() {
        return isAuthenticated()?currentUser:null;
    }
}
